package es.etsii.pl.P6_Flexer;

import org.antlr.runtime.*;

//import es.etsii.pl.P6_Flexer.TParser.a_return;


/**
 * Test driver program for the ANTLR3 Maven Architype demo
 *
 * @author Jim Idle (jimi@temporal-wave.com)
 */
class Main {

	public static final int GDL_LEXER = 0;
	public static final int XML_LEXER = 1;
	public static final int C_LEXER = 2;
	public static final int ANTLR_LEXER = 3;

 	public static void main(String[] args) {
 		try { //args[0] = opcion, args[1] = file
 			switch(Integer.parseInt(args[0])) {
            case GDL_LEXER:
               GraphLexer gdlexer = new GraphLexer(new ANTLRFileStream(args[1]));
               CommonTokenStream gdltokens = new CommonTokenStream(gdlexer);
               GraphParser gdlparser = new GraphParser(gdltokens);
               gdlparser.gdldocument();
               break;
            case XML_LEXER:
               XMLexer xmlexer = new XMLexer(new ANTLRFileStream(args[1]));
               CommonTokenStream xmltokens = new CommonTokenStream(xmlexer);
               XMLParser xmlparser = new XMLParser(xmltokens);
               xmlparser.xmldocument();
               break;
            case C_LEXER:
                CLexer clexer = new CLexer(new ANTLRFileStream(args[1]));
                CommonTokenStream ctokens = new CommonTokenStream(clexer);
                CParser cparser = new CParser(ctokens);
                cparser.entrada();
                break;
            case ANTLR_LEXER:
            	ANTLRLexer antlrlexer = new ANTLRLexer(new ANTLRFileStream(args[1]));
                CommonTokenStream antlrtokens = new CommonTokenStream(antlrlexer);
                ANTLRParser antlrparser = new ANTLRParser(antlrtokens);
                antlrparser.entrada();
                break;
            default:
               break;
            }
         } catch (Exception e) {
        	e.printStackTrace();
         }
 	} //main
}